package com.lin.blog.controller;

import com.lin.blog.service.IArticleStatisticalService;
import com.lin.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: blog
 * @description: 图表控制
 * @author: Lin
 * @create: 2020-05-13 15:39
 **/
@Api(tags = "Echarts接口")
@RestController
@RequestMapping("/echarts")
public class EchartsController {

    /**
     * 文章统计
     */
    @Autowired
    private IArticleStatisticalService articleStatisticalService;

    /**
     * 获取文章统计
     * @return
     */
    @ApiOperation("获取文章统计")
    @GetMapping("/article/statistical")
    public Result getArticleStatistical(){
        return articleStatisticalService.getArticleStatistical();
    }


    /**
     * 获取文章统计 通过username
     * @return
     */
    @GetMapping("/article/statistical/{username}")
    public Result getArticleStatisticalByUsername(@PathVariable("username") String username){
        return articleStatisticalService.getArticleStatisticalByUsername(username);
    }

}